// You need to add 1 line of code at each of the 5 locations
// identified by embedded comments
package infotool;

import java.util.*;

public class InfoController {
    
    // model data
    private InfoModel model;
    private InfoView view;
    private static int conNo=0;
    private int conId;
    
    
    public InfoController(InfoModel model, InfoView view) {
        conId = ++conNo;
        System.out.println("Controller " + conId +
                ": InfoController(model, view)");
        this.model = model;
        this.view = view;
        //** 1 Students action required: There is a missing line of code
        //**   Hint - The controller should register itself as a listener
        //**   of user gestures (button pushes) hosted on the view.
        //**   Another hint - Call the addUserGestureListener method
        //**   of the view object and pass it this controller object.
        this.view.addUserGestureListener(this);
    }
    
    // user gesture handler methods
    public void processGetMessage() {
        System.out.println("Controller " + conId +
                ": processGetMessage() ");
        //** 1 Students action required: There is a missing line of code
        //**   Hint - The controller should ask the view to display the
        //**   is message page.
        //**   Additional hint - Call the showDisplay method of the view
        //**   and pass it the string "message".
        this.view.showDisplay("message");
    }
    
    public void processGetWeather() {
        System.out.println("Controller " + conId +
                ": processGetWeather() ");
        //** 1 Students action required: There is a missing line of code
        //**   Hint - The controller should ask the view to display the
        //**   is weather page.
        //**   Additional hint - Call the showDisplay method of the view
        //**   and pass it the string "weather".
        this.view.showDisplay("weather");
    }
    
    public void processMsgUpdate(String msg) {
        System.out.println("Controller " + conId +
                ": processMsgUpdate() ");
        //** 1 Students action required: There is a missing line of code
        //**   Hint - The controller should update the model with
        //**   the new message held in the input parameter msg.
        //**   Additional hint - Call the setMessage method of the model
        //**   and pass it the input parameter msg.
        this.model.setMessage(msg);
    }
    
    public void processWthUpdate(String wth) {
        System.out.println("Controller " + conId +
                ": processWthUpdate() ");
        //** 1 Students action required: There is a missing line of code
        //**   Hint - The controller should update the model with
        //**   the new weather info held in the input parameter wth.
        //**   Additional hint - Call the setWeather method of the model
        //**   and pass it the input parameter wth.
        this.model.setWeather(wth);
    }
}